﻿namespace SL651Center2.x.Enums
{
    /// <summary>
    /// 要素编码
    /// </summary>
    public enum ElementCode : byte
    {
        /// <summary>
        /// 观测时间引导符
        /// </summary>
        TT = 0xF0,
        /// <summary>
        /// 测站编码
        /// </summary>
        ST = 0xF1,
        /// <summary>
        /// 人工置数
        /// </summary>
        RGZS = 0xF2,
        /// <summary>
        /// 图片信息
        /// </summary>
        PIC = 0xF3,
        /// <summary>
        /// 1小时内每5min时段降雨量
        /// </summary>
        DRP = 0xF4,
        /// <summary>
        /// 1小时内5分钟间隔相对水位1
        /// 对于河道，闸（泵）站分别表示河道水位，闸（站）上水位
        /// </summary>
        DRZ1 = 0xF5,
        /// <summary>
        /// 1小时内5分钟间隔相对水位2
        /// 对于闸（泵）站表示闸（站）下水位
        /// </summary>
        DRZ2 = 0xF6,
        /// <summary>
        /// 1小时内5分钟间隔相对水位3
        /// </summary>
        DRZ3 = 0xF7,
        /// <summary>
        /// 1小时内5分钟间隔相对水位4
        /// </summary>
        DRZ4 = 0xF8,
        /// <summary>
        /// 1小时内5分钟间隔相对水位5
        /// </summary>
        DRZ5 = 0xF9,
        /// <summary>
        /// 1小时内5分钟间隔相对水位6
        /// </summary>
        DRZ6 = 0xFA,
        /// <summary>
        /// 1小时内5分钟间隔相对水位7
        /// </summary>
        DRZ7 = 0xFB,
        /// <summary>
        /// 1小时内5分钟间隔相对水位8
        /// </summary>
        DRZ8 = 0xFC,
        /// <summary>
        /// 流速批量数据传输
        /// </summary>
        DATA = 0xFD,
        /// <summary>
        /// 断面面积
        /// </summary>
        AC = 0x01,
        /// <summary>
        /// 瞬时气温
        /// </summary>
        AI = 0x02,
        /// <summary>
        /// 瞬时水温
        /// </summary>
        C = 0x03,
        /// <summary>
        /// 时间步长码
        /// </summary>
        DRxnn = 0x04,
        /// <summary>
        /// 时段长，降水、引排水、抽水历时
        /// </summary>
        DT = 0x05,
        /// <summary>
        /// 日蒸发量
        /// </summary>
        ED = 0x06,
        /// <summary>
        /// 当前蒸发
        /// </summary>
        EJ = 0x07,
        /// <summary>
        /// 气压
        /// </summary>
        FL = 0x08,
        /// <summary>
        /// 闸坝，水库闸门开启高度
        /// </summary>
        GH = 0x09,
        /// <summary>
        /// 输水设备，闸门（组）编号
        /// </summary>
        GN = 0x0A,
        /// <summary>
        /// 输水设备类别
        /// </summary>
        GS = 0x0B,
        /// <summary>
        /// 水库、闸坝闸门开启孔数
        /// </summary>
        GT = 0x0C,
        /// <summary>
        /// 地温
        /// </summary>
        GTP = 0x0D,
        /// <summary>
        /// 地下水瞬时埋深
        /// </summary>
        H = 0x0E,
        /// <summary>
        /// 波浪高度
        /// </summary>
        HW = 0x0F,
        /// <summary>
        /// 10厘米处土壤含水量
        /// </summary>
        M10 = 0x10,
        /// <summary>
        /// 20厘米处土壤含水量
        /// </summary>
        M20 = 0x11,
        /// <summary>
        /// 30厘米处土壤含水量
        /// </summary>
        M30 = 0x12,
        /// <summary>
        /// 40厘米处土壤含水量
        /// </summary>
        M40 = 0x13,
        /// <summary>
        /// 50厘米处土壤含水量
        /// </summary>
        M50 = 0x14,
        /// <summary>
        /// 60厘米处土壤含水量
        /// </summary>
        M60 = 0x15,
        /// <summary>
        /// 80厘米处土壤含水量
        /// </summary>
        M80 = 0x16,
        /// <summary>
        /// 100厘米处土壤含水量
        /// </summary>
        M100 = 0x17,
        /// <summary>
        /// 湿度
        /// </summary>
        MST = 0x18,
        /// <summary>
        /// 开机台数
        /// </summary>
        NS = 0x19,
        /// <summary>
        /// 1小时段降水量
        /// </summary>
        P1 = 0x1A,
        /// <summary>
        /// 2小时段降水量
        /// </summary>
        P2 = 0x1B,
        /// <summary>
        /// 3小时段降水量
        /// </summary>
        P3 = 0x1C,
        /// <summary>
        /// 6小时段降水量
        /// </summary>
        P6 = 0x1D,
        /// <summary>
        /// 12小时段降水量
        /// </summary>
        P12 = 0x1E,
        /// <summary>
        /// 日降水量
        /// </summary>
        PD = 0x1F,
        /// <summary>
        /// 当前降水量
        /// </summary>
        PJ = 0x20,
        /// <summary>
        /// 1分时段降水量
        /// </summary>
        PN01 = 0x21,
        /// <summary>
        /// 5分时段降水量
        /// </summary>
        PN05 = 0x22,
        /// <summary>
        /// 10分时段降水量
        /// </summary>
        PN10 = 0x23,
        /// <summary>
        /// 30分时段降水量
        /// </summary>
        PN30 = 0x24,
        /// <summary>
        /// 暴雨量
        /// </summary>
        PR = 0x25,
        /// <summary>
        /// 降水量累计值
        /// </summary>
        PT = 0x26,
        /// <summary>
        /// 瞬时流量、抽水流量
        /// </summary>
        Q = 0x27,
        /// <summary>
        /// 取（排）水口流量1
        /// </summary>
        Q1 = 0x28,
        /// <summary>
        /// 取（排）水口流量2
        /// </summary>
        Q2 = 0x29,
        /// <summary>
        /// 取（排）水口流量3
        /// </summary>
        Q3 = 0x2A,
        /// <summary>
        /// 取（排）水口流量4
        /// </summary>
        Q4 = 0x2B,
        /// <summary>
        /// 取（排）水口流量5
        /// </summary>
        Q5 = 0x2C,
        /// <summary>
        /// 取（排）水口流量6
        /// </summary>
        Q6 = 0x2D,
        /// <summary>
        /// 取（排）水口流量7
        /// </summary>
        Q7 = 0x2E,
        /// <summary>
        ///  取（排）水口流量8
        /// </summary>
        Q8 = 0x2F,
        /// <summary>
        /// 总出库流量、过闸总流量
        /// </summary>
        QA = 0x30,
        /// <summary>
        /// 输水设备流量、过闸（组）流量
        /// </summary>
        QZ = 0x31,
        /// <summary>
        /// 输沙量
        /// </summary>
        SW = 0x32,
        /// <summary>
        /// 风向
        /// </summary>
        UC = 0x33,
        /// <summary>
        /// 风力（级）
        /// </summary>
        UE = 0x34,
        /// <summary>
        /// 风速
        /// </summary>
        US = 0x35,
        /// <summary>
        /// 断面平均流速
        /// </summary>
        VA = 0x36,
        /// <summary>
        /// 当前瞬时流速
        /// </summary>
        VJ = 0x37,
        /// <summary>
        /// 电源电压
        /// </summary>
        VT = 0x38,
        /// <summary>
        /// 瞬时河道水位、潮位
        /// </summary>
        Z = 0x39,
        /// <summary>
        /// 库（闸、站）下水位
        /// </summary>
        ZB = 0x3A,
        /// <summary>
        /// 库（闸、站）上水位
        /// </summary>
        ZU = 0x3B,
        /// <summary>
        /// 取（排）水口水位1
        /// </summary>
        Z1 = 0x3C,
        /// <summary>
        /// 取（排）水口水位2
        /// </summary>
        Z2 = 0x3D,
        /// <summary>
        /// 取（排）水口水位3
        /// </summary>
        Z3 = 0x3E,
        /// <summary>
        /// 取（排）水口水位4
        /// </summary>
        Z4 = 0x3F,
        /// <summary>
        /// 取（排）水口水位5
        /// </summary>
        Z5 = 0x40,
        /// <summary>
        /// 取（排）水口水位6
        /// </summary>
        Z6 = 0x41,
        /// <summary>
        /// 取（排）水口水位7
        /// </summary>
        Z7 = 0x42,
        /// <summary>
        /// 取（排）水口水位8
        /// </summary>
        Z8 = 0x43,
        /// <summary>
        /// 含沙量
        /// </summary>
        SQ = 0x44,
        /// <summary>
        /// 遥测站状态级报警信息
        /// </summary>
        ZT = 0x45,
        /// <summary>
        /// pH值
        /// </summary>
        pH = 0x46,
        /// <summary>
        /// 溶解氧
        /// </summary>
        DO = 0x47,
        /// <summary>
        /// 电导率
        /// </summary>
        COND = 0x48,
        /// <summary>
        /// 浊度
        /// </summary>
        TURB = 0x49,
        /// <summary>
        /// 高猛酸盐指数
        /// </summary>
        CODMN = 0x4A,
        /// <summary>
        /// 氧化还原电位
        /// </summary>
        REDOX = 0x4B,
        /// <summary>
        /// 氨氮
        /// </summary>
        NH4N = 0x4C,
        /// <summary>
        /// 总磷
        /// </summary>
        TP = 0x4D,
        /// <summary>
        /// 总氮
        /// </summary>
        TN = 0x4E,
        /// <summary>
        /// 总有机碳
        /// </summary>
        TOC = 0x4F,
        /// <summary>
        /// 铜
        /// </summary>
        CU = 0x50,
        /// <summary>
        /// 锌
        /// </summary>
        ZN = 0x51,
        /// <summary>
        /// 硒
        /// </summary>
        SE = 0x52,
        /// <summary>
        /// 砷
        /// </summary>
        AS = 0x53,
        /// <summary>
        /// 总汞
        /// </summary>
        THG = 0x54,
        /// <summary>
        /// 镉
        /// </summary>
        CD = 0x55,
        /// <summary>
        /// 铅
        /// </summary>
        PB = 0x56,
        /// <summary>
        /// 叶绿素a
        /// </summary>
        CHLA = 0x57,
        /// <summary>
        /// 水压1
        /// </summary>
        WP1 = 0x58,
        /// <summary>
        /// 水压2
        /// </summary>
        WP2 = 0x59,
        /// <summary>
        /// 水压3
        /// </summary>
        WP3 = 0x5A,
        /// <summary>
        /// 水压4
        /// </summary>
        WP4 = 0x5B,
        /// <summary>
        /// 水压5
        /// </summary>
        WP5 = 0x5C,
        /// <summary>
        /// 水压6
        /// </summary>
        WP6 = 0x5D,
        /// <summary>
        /// 水压7
        /// </summary>
        WP7 = 0x5E,
        /// <summary>
        /// 水压8
        /// </summary>
        WP8 = 0x5F,
        /// <summary>
        /// 水表1剩余水量
        /// </summary>
        SYL1 = 0x60,
        /// <summary>
        /// 水表2剩余水量
        /// </summary>
        SYL2 = 0x61,
        /// <summary>
        /// 水表3剩余水量
        /// </summary>
        SYL3 = 0x62,
        /// <summary>
        /// 水表4剩余水量
        /// </summary>
        SYL4 = 0x63,
        /// <summary>
        /// 水表5剩余水量
        /// </summary>
        SYL5 = 0x64,
        /// <summary>
        /// 水表6剩余水量
        /// </summary>
        SYL6 = 0x65,
        /// <summary>
        /// 水表7剩余水量
        /// </summary>
        SYL7 = 0x66,
        /// <summary>
        /// 水表8剩余水量
        /// </summary>
        SYL8 = 0x67,
        /// <summary>
        /// 水表1每小时水量
        /// </summary>
        SBL1 = 0x68,
        /// <summary>
        /// 水表2每小时水量
        /// </summary>
        SBL2 = 0x69,
        /// <summary>
        /// 水表3每小时水量
        /// </summary>
        SBL3 = 0x6A,
        /// <summary>
        /// 水表4每小时水量
        /// </summary>
        SBL4 = 0x6B,
        /// <summary>
        /// 水表5每小时水量
        /// </summary>
        SBL5 = 0x6C,
        /// <summary>
        /// 水表6每小时水量
        /// </summary>
        SBL6 = 0x6D,
        /// <summary>
        /// 水表7每小时水量
        /// </summary>
        SBL7 = 0x6E,
        /// <summary>
        /// 水表8每小时水量
        /// </summary>
        SBL8 = 0x6F,
        /// <summary>
        /// 交流A相电压
        /// </summary>
        VTA = 0x70,
        /// <summary>
        /// 交流B相电压
        /// </summary>
        VTB = 0x71,
        /// <summary>
        /// 交流C相电压
        /// </summary>
        VTC = 0x72,
        /// <summary>
        /// 交流A相电流
        /// </summary>
        VIA = 0x73,
        /// <summary>
        /// 交流B相电流
        /// </summary>
        VIB = 0x74,
        /// <summary>
        /// 交流C相电流
        /// </summary>
        VIC = 0x75,

    }

    /// <summary>
    /// 要素的相关信息
    /// </summary>
    public class ElementInfo
    {
        public static ElementInfo Instance { get; } = new ElementInfo();
        private Dictionary<ElementCode, (string name, string units)> _elementInfo = new Dictionary<ElementCode, (string name, string unit)>();

        private ElementInfo()
        {
            Register(ElementCode.TT, ("观测时间引导符", ""));
            Register(ElementCode.ST, ("测站编码引导符", ""));
            Register(ElementCode.RGZS, ("人工置数", "字节"));
            Register(ElementCode.PIC, ("图片信息", "KB"));
            Register(ElementCode.DRP, ("1小时内每5分钟时段雨量", "mm"));
            Register(ElementCode.DRZ1, ("1小时内5间隔相对水位1", "m"));
            Register(ElementCode.DRZ2, ("1小时内5间隔相对水位2", "m"));
            Register(ElementCode.DRZ3, ("1小时内5间隔相对水位3", "m"));
            Register(ElementCode.DRZ4, ("1小时内5间隔相对水位4", "m"));
            Register(ElementCode.DRZ5, ("1小时内5间隔相对水位5", "m"));
            Register(ElementCode.DRZ6, ("1小时内5间隔相对水位6", "m"));
            Register(ElementCode.DRZ7, ("1小时内5间隔相对水位7", "m"));
            Register(ElementCode.DRZ8, ("1小时内5间隔相对水位8", "m"));
            Register(ElementCode.DATA, ("流速批量数据", ""));
            Register(ElementCode.AC, ("断面面积", "㎡"));
            Register(ElementCode.AI, ("瞬时气温", "℃"));
            Register(ElementCode.C, ("瞬时水温", "℃"));
            Register(ElementCode.DRxnn, ("时间步长码", ""));
            Register(ElementCode.DT, ("时段长，、降水、引排水、抽水历时", "h.min"));
            Register(ElementCode.ED, ("日蒸发量", "mm"));
            Register(ElementCode.EJ, ("当前蒸发", "mm"));
            Register(ElementCode.FL, ("气压", "百帕"));
            Register(ElementCode.GH, ("闸坝、水库闸门开启高度", "m"));
            Register(ElementCode.GN, ("输水设备、闸门(组)编号", ""));
            Register(ElementCode.GS, ("输水设备类别", ""));
            Register(ElementCode.GT, ("水库、闸坝闸门开启孔数", "孔"));
            Register(ElementCode.GTP, ("地温", "℃"));
            Register(ElementCode.H, ("地下水瞬时埋深", "m"));
            Register(ElementCode.HW, ("波浪高度", "m"));
            Register(ElementCode.M10, ("10厘米处土壤含水量", "%"));
            Register(ElementCode.M20, ("20厘米处土壤含水量", "%"));
            Register(ElementCode.M30, ("30厘米处土壤含水量", "%"));
            Register(ElementCode.M40, ("40厘米处土壤含水量", "%"));
            Register(ElementCode.M50, ("50厘米处土壤含水量", "%"));
            Register(ElementCode.M60, ("60厘米处土壤含水量", "%"));
            Register(ElementCode.M80, ("80厘米处土壤含水量", "%"));
            Register(ElementCode.M100, ("100厘米处土壤含水量", "%"));
            Register(ElementCode.MST, ("湿度", "%"));
            Register(ElementCode.NS, ("开机台数", "台"));
            Register(ElementCode.P1, ("1小时时段降水量", "mm"));
            Register(ElementCode.P2, ("2小时时段降水量", "mm"));
            Register(ElementCode.P3, ("3小时时段降水量", "mm"));
            Register(ElementCode.P6, ("6小时时段降水量", "mm"));
            Register(ElementCode.P12, ("12小时时段降水量", "mm"));
            Register(ElementCode.PD, ("日降水量", "mm"));
            Register(ElementCode.PJ, ("当前降水量", "mm"));
            Register(ElementCode.PN01, ("1分钟时段降水量", "mm"));
            Register(ElementCode.PN05, ("5分钟时段降水量", "mm"));
            Register(ElementCode.PN10, ("10分钟时段降水量", "mm"));
            Register(ElementCode.PN30, ("30分钟时段降水量", "mm"));
            Register(ElementCode.PR, ("暴雨量", "mm"));
            Register(ElementCode.PT, ("降水量累计值", "mm"));
            Register(ElementCode.Q, ("瞬时流量、抽水流量", "m³/s"));
            Register(ElementCode.Q1, ("取(排)水口流量1", "m³/s"));
            Register(ElementCode.Q2, ("取(排)水口流量2", "m³/s"));
            Register(ElementCode.Q3, ("取(排)水口流量3", "m³/s"));
            Register(ElementCode.Q4, ("取(排)水口流量4", "m³/s"));
            Register(ElementCode.Q5, ("取(排)水口流量5", "m³/s"));
            Register(ElementCode.Q6, ("取(排)水口流量6", "m³/s"));
            Register(ElementCode.Q7, ("取(排)水口流量7", "m³/s"));
            Register(ElementCode.Q8, ("取(排)水口流量8", "m³/s"));
            Register(ElementCode.QA, ("总出库流量、过闸总流量", "m³/s"));
            Register(ElementCode.QZ, ("输水设备流量、过闸(组)流量", "m³/s"));
            Register(ElementCode.SW, ("输沙量", "万t"));
            Register(ElementCode.UC, ("风向", ""));
            Register(ElementCode.UE, ("风力(级)", ""));
            Register(ElementCode.US, ("风速", "m/s"));
            Register(ElementCode.VA, ("断面平均流速", "m/s"));
            Register(ElementCode.VJ, ("当前瞬时流速", "m/s"));
            Register(ElementCode.VT, ("电源电压", "V"));
            Register(ElementCode.Z, ("瞬时河道水位、潮位", "m"));
            Register(ElementCode.ZB, ("库(闸、站)下水位", "m"));
            Register(ElementCode.ZU, ("库(闸、站)上水位", "m"));
            Register(ElementCode.Z1, ("取(排)水口水位1", "m"));
            Register(ElementCode.Z2, ("取(排)水口水位2", "m"));
            Register(ElementCode.Z3, ("取(排)水口水位3", "m"));
            Register(ElementCode.Z4, ("取(排)水口水位4", "m"));
            Register(ElementCode.Z5, ("取(排)水口水位5", "m"));
            Register(ElementCode.Z6, ("取(排)水口水位6", "m"));
            Register(ElementCode.Z7, ("取(排)水口水位7", "m"));
            Register(ElementCode.Z8, ("取(排)水口水位8", "m"));
            Register(ElementCode.SQ, ("含沙量", "kg/m³"));
            Register(ElementCode.ZT, ("遥测站状态及报警信息", ""));
            Register(ElementCode.pH, ("ph值", ""));
            Register(ElementCode.DO, ("溶解氧", "mg/L"));
            Register(ElementCode.COND, ("电导率", "μS/cm"));
            Register(ElementCode.TURB, ("浊度", "度"));
            Register(ElementCode.CODMN, ("高猛酸盐指数", "mg/L"));
            Register(ElementCode.REDOX, ("氧化还原电位", "mV"));
            Register(ElementCode.NH4N, ("氨氮", "mg/L"));
            Register(ElementCode.TP, ("总磷", "mg/L"));
            Register(ElementCode.TN, ("总氮", "mg/L"));
            Register(ElementCode.TOC, ("总有机碳", "mg/L"));
            Register(ElementCode.CU, ("铜", "mg/L"));
            Register(ElementCode.ZN, ("锌", "mg/L"));
            Register(ElementCode.SE, ("硒", "mg/L"));
            Register(ElementCode.AS, ("砷", "mg/L"));
            Register(ElementCode.THG, ("总汞", "mg/L"));
            Register(ElementCode.CD, ("镉", "mg/L"));
            Register(ElementCode.PB, ("铅", "mg/L"));
            Register(ElementCode.CHLA, ("叶绿素a", "mg/L"));
            Register(ElementCode.WP1, ("水压1", "kPa"));
            Register(ElementCode.WP2, ("水压2", "kPa"));
            Register(ElementCode.WP3, ("水压3", "kPa"));
            Register(ElementCode.WP4, ("水压4", "kPa"));
            Register(ElementCode.WP5, ("水压5", "kPa"));
            Register(ElementCode.WP6, ("水压6", "kPa"));
            Register(ElementCode.WP7, ("水压7", "kPa"));
            Register(ElementCode.WP8, ("水压8", "kPa"));
            Register(ElementCode.SYL1, ("水表1剩余水量", "m³"));
            Register(ElementCode.SYL2, ("水表2剩余水量", "m³"));
            Register(ElementCode.SYL3, ("水表3剩余水量", "m³"));
            Register(ElementCode.SYL4, ("水表4剩余水量", "m³"));
            Register(ElementCode.SYL5, ("水表5剩余水量", "m³"));
            Register(ElementCode.SYL6, ("水表6剩余水量", "m³"));
            Register(ElementCode.SYL7, ("水表7剩余水量", "m³"));
            Register(ElementCode.SYL8, ("水表8剩余水量", "m³"));
            Register(ElementCode.SBL1, ("水表1每小时水量", "m³/h"));
            Register(ElementCode.SBL2, ("水表2每小时水量", "m³/h"));
            Register(ElementCode.SBL3, ("水表3每小时水量", "m³/h"));
            Register(ElementCode.SBL4, ("水表4每小时水量", "m³/h"));
            Register(ElementCode.SBL5, ("水表5每小时水量", "m³/h"));
            Register(ElementCode.SBL6, ("水表6每小时水量", "m³/h"));
            Register(ElementCode.SBL7, ("水表7每小时水量", "m³/h"));
            Register(ElementCode.SBL8, ("水表8每小时水量", "m³/h"));
            Register(ElementCode.VTA, ("交流A相电压", "V"));
            Register(ElementCode.VTB, ("交流B相电压", "V"));
            Register(ElementCode.VTC, ("交流C相电压", "V"));
            Register(ElementCode.VIA, ("交流A相电流", "A"));
            Register(ElementCode.VIB, ("交流B相电流", "A"));
            Register(ElementCode.VIC, ("交流C相电流", "A"));

        }
        private void Register(ElementCode code, (string name, string unit) info)
        {
            _elementInfo[code] = info;
        }

        /// <summary>
        /// 获取当前要素的数据长度和精度
        /// </summary>
        /// <param name="code">要素编码</param>
        /// <returns>要素的数据字节长度和精度</returns>
        public static (int d, decimal pre) GetValueType(ElementCode code)
        {
            switch (code)
            {
                case ElementCode.DRP:
                    return (1, 10);
                case ElementCode.DRZ1:
                case ElementCode.DRZ2:
                case ElementCode.DRZ3:
                case ElementCode.DRZ4:
                case ElementCode.DRZ5:
                case ElementCode.DRZ6:
                case ElementCode.DRZ7:
                case ElementCode.DRZ8:
                    return (2, 100);
                case ElementCode.AC:
                    return (4, 100);
                case ElementCode.AI:
                case ElementCode.C:
                case ElementCode.GTP:
                case ElementCode.M10:
                case ElementCode.M20:
                case ElementCode.M30:
                case ElementCode.M40:
                case ElementCode.M50:
                case ElementCode.M60:
                case ElementCode.M80:
                case ElementCode.M100:
                case ElementCode.MST:
                case ElementCode.US:
                case ElementCode.DO:
                case ElementCode.CODMN:
                case ElementCode.VTA:
                case ElementCode.VTB:
                case ElementCode.VTC:
                case ElementCode.VIA:
                case ElementCode.VIB:
                case ElementCode.VIC:
                    return (2, 10);
                //case ElementCode.DRxnn:
                case ElementCode.GN:
                case ElementCode.GT:
                case ElementCode.TURB:
                    return (2, 1);
                case ElementCode.ED:
                case ElementCode.EJ:
                case ElementCode.P1:
                case ElementCode.P2:
                case ElementCode.P3:
                case ElementCode.P6:
                case ElementCode.P12:
                case ElementCode.PD:
                case ElementCode.PJ:
                case ElementCode.PN01:
                case ElementCode.PN05:
                case ElementCode.PN10:
                case ElementCode.PN30:
                case ElementCode.PR:
                case ElementCode.PT:
                case ElementCode.REDOX:
                    return (3, 10);
                case ElementCode.FL:
                case ElementCode.COND:
                    return (3, 1);
                case ElementCode.GH:
                case ElementCode.H:
                case ElementCode.HW:
                case ElementCode.NH4N:
                case ElementCode.TN:
                case ElementCode.WP1:
                case ElementCode.WP2:
                case ElementCode.WP3:
                case ElementCode.WP4:
                case ElementCode.WP5:
                case ElementCode.WP6:
                case ElementCode.WP7:
                case ElementCode.WP8:
                    return (3, 100);
                case ElementCode.GS:
                case ElementCode.NS:
                case ElementCode.UC:
                case ElementCode.UE:
                    return (1, 1);
                case ElementCode.Q:
                case ElementCode.Q1:
                case ElementCode.Q2:
                case ElementCode.Q3:
                case ElementCode.Q4:
                case ElementCode.Q5:
                case ElementCode.Q6:
                case ElementCode.Q7:
                case ElementCode.Q8:
                case ElementCode.QA:
                case ElementCode.QZ:
                case ElementCode.SQ:
                    return (5, 1000);
                case ElementCode.SW:
                case ElementCode.SYL1:
                case ElementCode.SYL2:
                case ElementCode.SYL3:
                case ElementCode.SYL4:
                case ElementCode.SYL5:
                case ElementCode.SYL6:
                case ElementCode.SYL7:
                case ElementCode.SYL8:
                    return (6, 1000);
                case ElementCode.VA:
                case ElementCode.VJ:
                case ElementCode.TP:
                    return (3, 1000);
                case ElementCode.VT:
                case ElementCode.pH:
                case ElementCode.TOC:
                case ElementCode.CHLA:
                    return (2, 100);
                case ElementCode.Z:
                case ElementCode.ZB:
                case ElementCode.ZU:
                case ElementCode.Z1:
                case ElementCode.Z2:
                case ElementCode.Z3:
                case ElementCode.Z4:
                case ElementCode.Z5:
                case ElementCode.Z6:
                case ElementCode.Z7:
                case ElementCode.Z8:
                    return (4, 1000);
                case ElementCode.CU:
                    return (4, 10000);
                case ElementCode.ZN:
                    return (3, 10000);
                case ElementCode.SE:
                case ElementCode.AS:
                case ElementCode.THG:
                case ElementCode.CD:
                case ElementCode.PB:
                    return (4, 10000);
                case ElementCode.SBL1:
                case ElementCode.SBL2:
                case ElementCode.SBL3:
                case ElementCode.SBL4:
                case ElementCode.SBL5:
                case ElementCode.SBL6:
                case ElementCode.SBL7:
                case ElementCode.SBL8:
                    return (5, 100);
                default:
                    return (0, 1);

            }
        }

        /// <summary>
        /// 根据枚举值获取当前要素的名称和单位信息
        /// </summary>
        /// <param name="code">要素编码</param>
        /// <returns>要素的名称和单位</returns>
        public (string name, string unit) GetInfo(ElementCode code)
        {
            if (_elementInfo.TryGetValue(code, out var info))
            {
                return info;
            }
            return ("", "");
        }

        /// <summary>
        /// 根据枚举字符串获取当前要素的名称和单位信息
        /// </summary>
        /// <param name="str">要素字符串</param>
        /// <returns>要素的名称和单位</returns>
        public (string name, string unit) GetInfo(string str)
        {
            if (Enum.IsDefined(typeof(ElementCode), str))
            {
                var code = (ElementCode)Enum.Parse(typeof(ElementCode), str);
                if (_elementInfo.TryGetValue(code, out var info))
                {
                    return info;
                }
            }
            return ("", "");
        }

    }

}
